<template>
	<view class="lawyer-detail" v-if="lawyerDetailData">
		<common-navbar title="律师详情" />
		<topBg />
		<lawyerIntroduce :lawyerDetailData="lawyerDetailData" :serviceScore="serviceScore" />
		<consultList :lawyerDetailData="lawyerDetailData" />
		<serviceEvaluation :serviceScore="serviceScore" :lawyerEvaluationList="lawyerEvaluationList" v-if="lawyerEvaluationList.total"/>
		<bottomConsultBar :lawyerDetailData="lawyerDetailData" />
	</view>
</template>

<script>
	import topBg from "./components/top-bg/topBg.vue";
	import lawyerIntroduce from "./components/lawyer-introduce/lawyerIntroduce";
	import consultList from "./components/consult-list/consultList.vue";
	import serviceEvaluation from "./components/service-evaluation/serviceEvaluation.vue";
	import bottomConsultBar from "./components/bottom-consult-bar/bottomConsultBar.vue";
	export default {
		components: {
			topBg,
			lawyerIntroduce,
			consultList,
			serviceEvaluation,
			bottomConsultBar,
		},

		onLoad(options) {
			this.lawyerId = options.id;
			this.getLawyerDetail();
			this.getLawyerEvaluationList();
		},
		data() {
			return {
				lawyerId: '',
				lawyerDetailData: null,
				serviceScore: {
					score: '--',
					service_total: '--',
					minute: '--',
				},
				lawyerEvaluationList:null,
			}
		},
		methods: {
			async getLawyerDetail() {
				const {
					data
				} = await this.$u.post(this.$restUrl.getLawyerDetail, {
					lawyer_id: this.lawyerId,
				})
				this.lawyerDetailData = data;
				const res = await this.$u.post(this.$restUrl.getEvaluateQuality, {
					lid: this.lawyerId,
				})
				this.serviceScore = res.data;
			},
			async getLawyerEvaluationList() {
				const {
					data
				} = await this.$u.post(this.$restUrl.lawyerEvaluationList, {
					lid: this.lawyerId,
					// lid:23,
					page: 1,
					page_num: 2,
				})
				this.lawyerEvaluationList = data;
				console.log('this.lawyerEvaluationList>>>>>>>>>>>>>>>>>>>>>>>',this.lawyerEvaluationList);
			}
		}
	}
</script>

<style scoped lang="scss">
	@import "./lawyerDetail.scss";
</style>
